package com.zlsy.springbootdemo.proxy.service.impl;

import com.zlsy.springbootdemo.proxy.service.Image;

/**
 * @author zhouliang
 * @date 2021/1/19 20:09
 */
public class ProxyImage implements Image {
  private RealImage realImage;
  private String fileName;

  public ProxyImage(String fileName) {
    this.fileName = fileName;
  }

  @Override
  public void display() {
    if (null == realImage) {
      realImage = new RealImage(fileName);
    }
    realImage.display();
  }
}
